<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head><title>
FFTW FAQ - Section 2
</title>
<link rev="made" href="mailto:fftw@fftw.org">
<link rel="Contents" href="index.html">
<link rel="Start" href="index.html">
<link rel="Next" href="section3.html"><link rel="Previous" href="section1.html"><link rel="Bookmark" title="FFTW FAQ" href="index.html">
</head><body text="#000000" bgcolor="#FFFFFF"><h1>
FFTW FAQ - Section 2 <br>
Installing FFTW
</h1>

<ul>
<li><a href="#systems" rel=subdocument>Q2.1. Which systems does FFTW run on?</a>
<li><a href="#runOnDOS" rel=subdocument>Q2.2. Does FFTW run on DOS/Windows?</a>
<li><a href="#compilerCrashes" rel=subdocument>Q2.3. My compiler has trouble with FFTW.</a>
<li><a href="#solarisSucks" rel=subdocument>Q2.4. FFTW does not compile on Solaris, complaining about
<code>const</code>.</a>
<li><a href="#languages" rel=subdocument>Q2.5. Which language is FFTW written in?</a>
<li><a href="#fortran" rel=subdocument>Q2.6. Can I call FFTW from FORTRAN?</a>
<li><a href="#cplusplus" rel=subdocument>Q2.7. Can I call FFTW from C++?</a>
<li><a href="#whynotfortran" rel=subdocument>Q2.8. Why isn't FFTW written in FORTRAN/C++?</a>
<li><a href="#singleprec" rel=subdocument>Q2.9. How do I compile FFTW to run in single precision?</a>
</ul><hr>

<h2><A name="systems">
Question 2.1.  Which systems does FFTW run
on?
</A></h2>

FFTW is written in ANSI C, and should work on any system with
a decent C compiler.  (See also <A href="#runOnDOS">Q2.2 `Does FFTW run on DOS/Windows?'</A> and  <A href="#compilerCrashes">Q2.3 `My compiler has trouble with FFTW.'</A>.) 
<h2><A name="runOnDOS">
Question 2.2.  Does FFTW run on DOS/Windows?
</A></h2>

It should.  FFTW was not developed on DOS or Windows, but the source
code is straight ANSI C.  Some users have reported using FFTW on
DOS/Windows using various compilers.  See also the
<A href="http://www.fftw.org/install/install-Windows.html">FFTW Windows installation notes</A> and <A href="#compilerCrashes">Q2.3 `My compiler has trouble with FFTW.'</A> 
<h2><A name="compilerCrashes">
Question 2.3.  My compiler has trouble with
FFTW.
</A></h2>

Complain fiercely to the vendor of the compiler. 

<p>
FFTW is a heavily-optimized piece of software that is likely to push
compilers to their limits.  We had no problems with, for example,
<code>gcc 2.7.2</code>, <code>egcs 1.1.x</code>, Sun's <code>SC4.0</code>, and IBM's <code>XLC</code>.  Users have also reported successful compilations of FFTW using Borland's C/C++ compilers on Windows. 

<p>
The Portland Group PGCC compiler, version 4.0 for Linux/x86,
reportedly produces incorrect code for FFTW 2.1.3. 

<p>
Visual C++ 4.0 crashes when compiling FFTW 1.2 with all optimizations
turned on.  Visual C++ 5.0 reportedly produces incorrect code for the
real transforms in FFTW 2.x when the option &quot;Maximize speed&quot;
is set.  We are told that Service Pack 3 fixes the bug. 

<p>
Metrowerks CodeWarrior Pro 4 reportedly generates incorrect code for
the PowerPC when compiling FFTW at optimization level 4.  Supposedly,
this bug is fixed in CW Pro 5 with all the latest updates applied. 
(No problems were reported for previous versions.)

<p>
Various problems have also been observed with SGI's MIPSpro compilers,
versions 7.2.0 and 7.2.1 (you may have to lower the optimization level
for some files to get them to compile); the bug seems to be fixed in
version 7.3.  The test program in earlier versions of FFTW had
problems with the <code>-xO5</code> option in Sun's <code>SC4.0</code> C compiler.  <code>egcs 1.0.2</code> produced incorrect code for FFTW on the PowerPC (corrected in <code>egcs 1.1</code>).  
<p>
The DEC C compiler, V5.8-009 on Digital UNIX V4.0 (Rev. 1091) is known
to have bugs with its EV6 tuning.  Specifically, compiling FFTW with
<code>-arch host</code> (the default) or <code>-arch ev6</code> on an Alpha EV6 can cause FFTW (e.g. <code>fftw_test -s 256</code>) to crash.  
<h2><A name="solarisSucks">
Question 2.4.  FFTW does not compile on Solaris, complaining about
<code>const</code>.
</A></h2>

We know that at least on Solaris 2.5.x with Sun's compilers 4.2 you
might get error messages from <code>make</code> such as 
<p>
<code>&quot;./fftw.h&quot;, line 88: warning: const is a keyword in ANSI
C</code> 
<p>
This is the case when the <code>configure</code> script reports that <code>const</code> does not work: 
<p>
<code>checking for working const... (cached) no</code> 
<p>
You should be aware that Solaris comes with two compilers, namely,
<code>/opt/SUNWspro/SC4.2/bin/cc</code> and <code>/usr/ucb/cc</code>.  The latter compiler is non-ANSI.  Indeed, it is a perverse shell script
that calls the real compiler in non-ANSI mode.  In order
to compile FFTW, change your path so that the right
<code>cc</code> is used.  
<p>
To know whether your compiler is the right one,  type
<code>cc -V</code>.  If the compiler prints ``<code>ucbcc</code>'', as in  
<p>
<code>ucbcc: WorkShop Compilers 4.2 30 Oct 1996 C
4.2</code> 
<p>
then the compiler is wrong.  The right message is something like

<p>
<code>cc: WorkShop Compilers 4.2 30 Oct 1996 C
4.2</code> 
<h2><A name="languages">
Question 2.5.  Which language is FFTW written
in?
</A></h2>

FFTW is written in ANSI C.  Most of the code, however, was
automatically generated by a program called
<code>genfft</code>, written in the Objective Caml dialect of ML.  You do not need to know ML or to
have an Objective Caml compiler in order to use FFTW. 

<p>
<code>genfft</code> is provided with the FFTW sources, which means that
you can play with the code generator if you want.  In this case, you
need a working Objective Caml system.  Objective Caml is available
from <code>ftp.inria.fr</code> in the directory <A href="ftp://ftp.inria.fr/lang/caml-light"><code>/lang/caml-light</code></A>.  
<h2><A name="fortran">
Question 2.6.  Can I call FFTW from FORTRAN?
</A></h2>

Yes, but not directly.  The main problem is that Fortran cannot pass
parameters by value.  However, FFTW can be called indirectly from
Fortran through the use of special C &quot;wrapper&quot; routines. 
Appropriate wrapper code, documented in the FFTW manual, is included with FFTW
(versions 1.3 and higher).  
<p>
By default, FFTW configures its wrapper routines to work with the
first compiler it finds, e.g. <code>g77</code>.  To configure for a different, incompatible Fortran compiler
<code>foobar</code>, use <code>./configure F77=foobar</code> when installing FFTW.  
<h2><A name="cplusplus">
Question 2.7.  Can I call FFTW from C++?
</A></h2>

Most definitely.  FFTW should compile and run under any C++ compiler. 

<h2><A name="whynotfortran">
Question 2.8.  Why isn't FFTW written in
FORTRAN/C++?
</A></h2>

Because we don't like those languages, and neither approaches the
portability of C.  
<h2><A name="singleprec">
Question 2.9.  How do I compile FFTW to run in single
precision?
</A></h2>

On a Unix system: <code>configure --enable-float</code>.  On a non-Unix system: edit <code>fftw/fftw.h</code> to <code>#define</code> the symbol <code>FFTW_ENABLE_FLOAT</code>.  In both cases, you must then recompile
FFTW.  <hr>
Next: <a href="section3.html" rel=precedes>Using FFTW</a>.<br>
Back: <a href="section1.html" rev=precedes>Introduction and General Information</a>.<br>
<a href="index.html" rev=subdocument>Return to contents</a>.<p>
<address>
<A href="http://www.fftw.org">Matteo Frigo and Steven G. Johnson</A> / <A href="mailto:fftw@fftw.org">fftw@fftw.org</A>
- 24 March 2003
</address><br>
Extracted from FFTW Frequently Asked Questions with Answers,
Copyright &copy; 2003 Massachusetts Institute of Technology.
</body></html>
